package com.xiaoy.core.bpm.engine.api;

import java.io.InputStream;
import java.util.List;

import com.xiaoy.core.bpm.engine.entity.InstanceProcessVO;
import com.xiaoy.core.bpm.engine.entity.ProcessDefineVO;
import com.xiaoy.core.bpm.engine.entity.ProcessInstantiate;
import com.xiaoy.core.bpm.engine.entity.ProcessNodeVO;
import com.xiaoy.core.bpm.engine.entity.ProcessTask;
import com.xiaoy.core.bpm.engine.exception.BPMEngineException;


/**
 * 提供流程接口的api,屏蔽各种流程引擎 
 * @author chenty
 * 创建时间 2012-5-9
 */
public interface WorkFlow {
	String APPLY_USER = "apply_user";
	
	/**
	 * 部署一个流程
	 * @param objs
	 * @return
	 * @throws BPMEngineException
	 */
	public ProcessDefineVO defineProcess (Object...objs) throws BPMEngineException;
	
	/**
	 * 获得所有发布了的流程
	 * @return List<ProcessDefine> 所有流程定义
	 * @throws BPMEngineException
	 */
	public List<ProcessDefineVO> getAllProcessDefinitions() throws BPMEngineException;
	
	/**
	 * 流程定义图
	 * @param processDefineId
	 * @return
	 * TODO
	 */
	public InputStream getProcessImageByProcessDefineId (String processDefineId) ;
	
	/**
	 * 开始一个流程实例
	 * @param id 部署的流程的流程id
	 * @param map 流程变量
	 * @return 
	 * @throws BPMEngineException
	 */
	public ProcessInstantiate createProcessInstanceById(InstanceProcessVO createProcessVO) throws BPMEngineException;
	
	/**
	 * 得到一个已定义的流程的所有实例
	 * @param id
	 * @return
	 */
	public List<ProcessInstantiate>  getProcessInstancesByDefineId(String id);
	
	/**
	 * 获得当前的流程图
	 * @param instanceId
	 * @return
	 * @throws BPMEngineException
	 */
	public InputStream getProcessImageByInstanceId(String instanceId) throws BPMEngineException;
	
	
	/**
	 * 我申请的流程
	 * @throws BPMEngineException
	 */
	public List <ProcessDefineVO> myApply(String username)throws BPMEngineException;
	
	
	/**
	 * 获得流程定义的所有节点
	 * @param defineId
	 * @return
	 */
	public List<ProcessNodeVO> getProcessNodesByDefineId (String defineId) ;
	
	
	//----------------------------------------------
	
	
	/**
	 * 得到uaername的待办任务
	 * @param username
	 * @return
	 */
	public List<ProcessTask> getTaskByUsername (String username);
	
	/**
	 * 删除一个部署的流程
	 * @param deploymentId
	 */
	public void delete (String id) ;
	
	
	
	
	
	
	public ProcessDefineVO getProcessDefinitionByDeployMentId(String deployMentId) throws BPMEngineException;

	
	

	
	
	public List<ProcessTask> getCurrentProcessTaskByInstanceId (String instanceId) ;
	
	
	

	
	
	
	
	
	

	
}
